/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pojo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Vanessinha
 */
@Entity
@Table(name = "tb_ator")
public class Ator implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ato_codigo")
    private Long atoCodigo;
    @Size(max = 255)
    @Column(name = "ato_nome")
    private String atoNome;
    @JoinTable(name = "tb_ator_filme", joinColumns = {
        @JoinColumn(name = "atofil_codAtor", referencedColumnName = "ato_codigo")}, inverseJoinColumns = {
        @JoinColumn(name = "atofil_codFilme", referencedColumnName = "fil_codigo")})
    @ManyToMany
    private List<Filme> filmes;

    public Ator() {
    }

    public Ator(Long atoCodigo) {
        this.atoCodigo = atoCodigo;
    }

    public Long getAtoCodigo() {
        return atoCodigo;
    }

    public void setAtoCodigo(Long atoCodigo) {
        this.atoCodigo = atoCodigo;
    }

    public String getAtoNome() {
        return atoNome;
    }

    public void setAtoNome(String atoNome) {
        this.atoNome = atoNome;
    }

    public List<Filme> getFilmes() {
        return filmes;
    }

    public void setFilmes(List<Filme> filmes) {
        this.filmes = filmes;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (atoCodigo != null ? atoCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ator)) {
            return false;
        }
        Ator other = (Ator) object;
        if ((this.atoCodigo == null && other.atoCodigo != null) || (this.atoCodigo != null && !this.atoCodigo.equals(other.atoCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pojo.TbAtor[ atoCodigo=" + atoCodigo + " ]";
    }
}
